<style scoped>
    .layui-form >>> .layui-form-select{
        z-index: inherit;
    }
    .inputDisabled {
        cursor: not-allowed;
        color: #a29e9e!important;
        background: none!important;
    }
    .layui-input-inline {
        width: 135px;
    }
</style>

<template>
    <div class="company">
        <form class="layui-form ">

        <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
            <ul class="layui-tab-title">
                <li class="layui-this">基本信息</li>
                <li>经营信息</li>
                <li>财务信息</li>
                <li>预收款</li>
                <li>应收账款</li>
            </ul>
            <div class="layui-tab-content" style="height:auto;">
                <div class="layui-tab-item layui-show">
                <input type="hidden" name="guid" placeholder="" autocomplete="off" :value="guid" class="layui-input">
                <input type="hidden" name="type" :value="customer.type" placeholder="" autocomplete="off" class="layui-input">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">名称</label>
                        <div class="layui-input-inline" style="width: 384px;">
                            <input type="text" name="name" :value="customer.name"  lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label" style="width: 60px;">客户类型</label>
                        <div class="layui-input-inline">
                            <select name="flag" lay-verify="required">
                                <option value="">请选择类型</option>
                                <option v-for="(item, index) in cusTypes" :key="item.dictkey" :value="item.dictkey" :selected="customer.flag == item.dictkey">{{item.dicttext}}</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label" style="width: 60px;">法人</label>
                        <div class="layui-input-inline">
                            <input type="text" name="legal" :value="customer.legal"   placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>


                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">商务人员</label>
                        <div class="layui-input-inline">
                            <input type="text" name="manager" :value="customer.manager"   placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label" style="width: 60px;">商务电话</label>
                        <div class="layui-input-inline">
                            <input type="text" name="managertel" :value="customer.managertel"    placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label" style="width: 60px;">商务邮箱</label>
                        <div class="layui-input-inline">
                            <input type="text" name="memail" :value="customer.memail"  placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">财务人员</label>
                        <div class="layui-input-inline">
                            <input type="text" name="financer" :value="customer.financer" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label" style="width: 60px;">财务电话</label>
                        <div class="layui-input-inline">
                            <input type="text" name="fintel" :value="customer.fintel" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label" style="width: 60px;">财务邮箱</label>
                        <div class="layui-input-inline">
                            <input type="text" name="finemail"   :value="customer.finemail"  placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label" style="width: 60px;">注册资金</label>
                        <div class="layui-input-inline">
                            <input type="text" name="registcapital" :value="customer.registcapital"   placeholder="" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-form-mid layui-word-aux">万元</div>
                    </div>
                </div>


                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">收货人</label>
                        <div class="layui-input-inline">
                            <input type="text" name="contact" :value="customer.contact"  placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label" style="width: 60px;">联系电话</label>
                        <div class="layui-input-inline">
                            <input type="text" name="contactno" :value="customer.contactno"   placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>



                <div class="layui-form-item">
                    <label class="layui-form-label">请选择地区</label>
                    <div class="layui-inline" style="width: 155px">
                        <select name="province" id="province" lay-verify="required"   lay-search lay-filter="province">
                            <option value="">省份</option>
                        </select>
                    </div>
                    <div class="layui-inline" style="width: 155px">
                        <select name="city" id="city" lay-verify="required"    lay-search lay-filter="city">

                        </select>
                    </div>
                    <div class="layui-inline" style="width: 161px">
                        <select name="district" id="district" lay-verify="required"    lay-search>

                        </select>
                    </div>
                           </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">应收账款</label>
                                <div class="layui-input-block">
                                    <input type="text" disabled   :value="customer.recbalance"    placeholder="" autocomplete="off" class="layui-input">
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">应付账款</label>
                                <div class="layui-input-block">
                                    <input type="text" disabled    :value="customer.payBalance"   placeholder="" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">余额</label>
                                <div class="layui-input-block">
                                    <input type="text" disabled   :value="customer.prebalance"    placeholder="" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">详细地址</label>
                                <div class="layui-input-block">
                                    <input type="text" :value="customer.address" name="address" lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">结算币种  </label>
                                <div class="layui-input-inline">
                                    <select name="currency" id="currency" lay-verify="required"  lay-search v-model="customer.currency">
                                        <option value="">请选择类型</option>
                                        <option v-for="(item, index) in currencydict" :key="item.dictkey" :value="item.dictkey">{{item.dicttext}}</option>
                                    </select>
                                </div>
                            </div>
<!--                            <div class="layui-form-item">-->
<!--                                <label class="layui-form-label">电商部门</label>-->
<!--                                <div class="layui-input-block">-->
<!--                                    <input type="radio" name="flag" value="1" title="是" :checked="customer.flag == 1">-->
<!--                                    <input type="radio" name="flag" value="2" title="否" :checked="customer.flag == 2">-->
<!--                                </div>-->
<!--                            </div>-->
                            <div class="layui-form-item">
                                <label class="layui-form-label">状态</label>
                                <div class="layui-input-block">
                                    <input type="radio" name="status" value="1" title="启用" :checked="customer.status == 1">
                                    <input type="radio" name="status" value="2" title="禁用" :checked="customer.status == 2">
                                </div>
                            </div>
                            <div class="layui-form-item layui-form-text">
                                <label class="layui-form-label">备注</label>
                                <div class="layui-input-block">
                                    <textarea name="remark" :value="customer.remark"  placeholder="请输入备注内容" class="layui-textarea"></textarea>
                                </div>
                            </div>

                </div>
                <div class="layui-tab-item">
                    <input v-if="baseinfo != ''" type="hidden" name="baseinfo.guid" :value="baseinfo.guid">
                    <div class="layui-form-item">
                        <label class="layui-form-label">保鲜库面积</label>
                        <div class="layui-input-block">
                            <input type="text" name="baseinfo.warehousearea" :value="baseinfo.warehousearea" placeholder=""
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">配送车数量</label>
                        <div class="layui-input-block">
                            <input type="text" name="baseinfo.truckcount" :value="baseinfo.truckcount" placeholder=""
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">年度销售目标</label>
                        <div class="layui-input-block">
                            <input type="text" name="baseinfo.saletarget" :value="baseinfo.saletarget" placeholder=""
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">经营品类</label>
                        <div class="layui-input-block">
                            <input type="text" name="baseinfo.category" :value="baseinfo.category" placeholder=""
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">备注</label>
                        <div class="layui-input-block">
                            <textarea name="baseinfo.remark" :value="baseinfo.remark" placeholder="请输入备注内容"
                                      class="layui-textarea"></textarea>
                        </div>
                    </div>
                </div>
                <div class="layui-tab-item">
                    <input v-if="financeinfo != ''" type="hidden" name="financeinfo.guid" :value="financeinfo.guid">
                    <div class="layui-form-item">
                        <label class="layui-form-label">开票类型</label>
                        <div class="layui-input-block">
                            <input type="text" name="financeinfo.invoicingtype" :value="financeinfo.invoicingtype"
                                   placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">开票电话</label>
                        <div class="layui-input-block">
                            <input type="text" name="financeinfo.invoicingtel" :value="financeinfo.invoicingtel"
                                   placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">统一社会信用代码</label>
                        <div class="layui-input-block">
                            <input type="text" name="financeinfo.creditcode" :value="financeinfo.creditcode" placeholder=""
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">开户行编号</label>
                        <div class="layui-input-block">
                            <input type="text" name="financeinfo.bankcode" :value="financeinfo.bankcode" placeholder=""
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">开户行名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="financeinfo.bankname" :value="financeinfo.bankname" placeholder=""
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">开户行帐号</label>
                        <div class="layui-input-block">
                            <input type="text" name="financeinfo.cardcode" :value="financeinfo.cardcode" placeholder=""
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">账户名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="financeinfo.cardname" :value="financeinfo.cardname" placeholder=""
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">开票地址</label>
                        <div class="layui-input-block">
                            <input type="text" name="financeinfo.address" :value="financeinfo.address" placeholder=""
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">营业执照号</label>
                        <div class="layui-input-block">
                            <input type="text" name="financeinfo.licensecode" :value="financeinfo.licensecode"
                                   placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">组织机构代码号</label>
                        <div class="layui-input-block">
                            <input type="text" name="financeinfo.orgcode" :value="financeinfo.orgcode" placeholder=""
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>


                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">备注</label>
                        <div class="layui-input-block">
                            <textarea name="financeinfo.remark" :value="financeinfo.remark"
                                      placeholder="请输入备注内容" class="layui-textarea"></textarea>
                        </div>
                    </div>
                </div>
                <div class="layui-tab-item">
                    <div class="layui-col-lg4 select-item" style="text-align: right;width: 100%;">
                        <div class="layui-inline" style="width: 190px">
                            <input type="text" id="starttime" autocomplete="off" placeholder="请选择操作起始时间" class="layui-input key">
                        </div>
                        <div class="layui-inline" style="width: 190px">
                            <input type="text" id="endtime" autocomplete="off"  placeholder="请选择操作截止时间" class="layui-input key">
                        </div>
                        <div class="layui-input-inline" style="width: 200px" id="cashflowtype"></div>
                        <button type="button" class="layui-btn sou" @click="search">搜索</button>
                    </div>
                    <p>
                        <span>余额：{{customer.prebalance != '' ? customer.prebalance : 0}} {{customer.currency == 2 ? '美元' : '元'}}</span>
                        <span style="margin-left: 15px;">货币预收款余额：{{customer.currPrebalance != '' ? customer.currPrebalance : 0}} {{customer.currency == 2 ? '美元' : '元'}}</span>
                        <span style="margin-left: 15px;">非货币预收款余额：{{customer.nocurrPrebalance != '' ? customer.nocurrPrebalance : 0}} {{customer.currency == 2 ? '美元' : '元'}}</span>
                        <button type="button" @click="reload" class="layui-btn layui-btn-sm layui-btn-primary" style="margin-left: 10px;"><i class="layui-icon">&#xe9aa;</i></button>
                    </p>
                    <div style="width: 100%; overflow: auto;margin-bottom: 10px;" id="textarea">
                        <table     class="layui-table layui-form">

                            <thead>
                            <tr>
                                <th>业务订单编号</th>
                                <th >交易金额</th>
                                <th >交易后余额</th>
                                <th >交易类型</th>
                                <th >备注</th>
                                <th >操作人员</th>
                                <th >操作时间</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr class="id9" v-for="(val, index) in cashflow" :key="val.guid">
                                <td>{{val.code}}</td>
                                <td>{{val.amount}}</td>
                                <td>{{val.prebalance}}</td>
                                <td>{{val.typename}}</td>
                                <td>{{val.remark}}</td>
                                <td>{{val.operator}}</td>
    <!--                            <td>{{val.createtime}}</td>-->
                                <td>{{val.lastupdate}}</td>
                            </tr>
                            </tbody>
                        </table>
                    </div>


                </div>
                <div class="layui-tab-item">
                    <p>金额：{{customer.recbalance}} {{customer.currency == 2 ? '美元' : '元'}}
                        <button type="button" @click="reload" class="layui-btn layui-btn-sm layui-btn-primary" style="margin-left: 10px;"><i class="layui-icon">&#xe9aa;</i></button>
                    </p>
                    <div style="width: 100%; overflow: auto;" >
                        <table     class="layui-table layui-form">

                            <thead>
                            <tr>
                                <th>业务订单编号</th>
                                <th >交易金额</th>
                                <th >交易后余额</th>
                                <th >交易类型</th>
                                <th >备注</th>
                                <th >操作人员</th>
                                <th >操作时间</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr class="id9" v-for="(val, index) in receivableflow" :key="val.guid">
                                <td>{{val.code}}</td>
                                <td>{{val.amount}}</td>
                                <td>{{val.recbalance}}</td>
                                <td>{{val.typename}}</td>
                                <td>{{val.remark}}</td>
                                <td>{{val.operator}}</td>
                                <td>{{val.lastupdate}}</td>
                            </tr>
                            </tbody>
                        </table>
                    </div>

                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="submit">立即提交</button>
                        <button class="layui-btn layui-btn-primary" @click="$parent.back">返回</button>
                    </div>
                </div>
            </div>
            </div>
        </form>
    </div>
</template>

<script>
    let qs = require('qs');
    export default {
        name: 'CustomerEdit',
        props: ['id'],

        data () {
            return {
                 guid : this.id,
                 adata: {},
                datacategory:{},
                typeEmnu:[],
                costincomeEmnu:[],
                customer:[],
                baseinfo:'',
                financeinfo: '',
                cashflow:{},
                receivableflow:[],
                currencydict: [],
                cusTypes: '',
                cashflowTypes: []
            }
        },
        mounted() {
            let that = this;
            layui.use('laydate', function(){
                var laydate = layui.laydate;
                //执行一个laydate实例
                laydate.render({
                    elem: '#starttime', //指定元素
                });
                laydate.render({
                    elem: '#endtime',
                });
            });

            //判断是修改还预收款
            that.guidePage();

            that.getCurrencyEmnu();
            that.getCusTypes();
            layui.use(['form'], function () {
                var form = layui.form,
                    layer = layui.layer;
                   that.getCustomer(that.guid);
                   that.getDictEmnu();
                form.on('submit(submit)', function (data) {

                    layer.confirm('确定要修改该数据？', function () {
                    //提交编辑过的数据

                        let loader = layer.load();
                        $.ajax({
                            url: '/sales/Customer!update.action',
                            data: data.field,
                            type: "post",
                            dataType: "json",
                            success: function(res) {
                                if (res.msg == "success") {
                                    that.toast("修改成功");
                                    that.$parent.switchPage('CustomerList');
                                }  else{
                                    that.toast("系统错误");
                                }
                            },
                            complete: function () {
                                layer.close(loader);
                            }
                        });
                    });
                    return false;
                })
            });

            layui.use('form', function() {
                var form = layui.form;

                var province = $("#province"),
                    city = $("#city"),
                    district = $("#district");

                //初始将省份数据赋予
                for (var i = 0; i < provinceList.length; i++) {
                    addEle(province, provinceList[i].name);
                }

                //赋予完成 重新渲染select
                form.render('select');

                //向select中 追加内容
                function addEle(ele, value) {
                    var optionStr = "";
                    optionStr = "<option value=" + value + " >" + value + "</option>";
                    ele.append(optionStr);
                }

                //移除select中所有项 赋予初始值
                function removeEle(ele) {
                    ele.find("option").remove();
                    var optionStar = "<option value=" + "" + ">" + "请选择" + "</option>";
                    ele.append(optionStar);
                }

                var provinceText,
                    cityText,
                    cityItem;

                //选定省份后 将该省份的数据读取追加上
                form.on('select(province)', function(data) {
                    provinceText = data.value;
                    $.each(provinceList, function(i, item) {
                        if (provinceText == item.name) {
                            cityItem = i;
                            return cityItem;
                        }
                    });
                    removeEle(city);
                    removeEle(district);
                    $.each(provinceList[cityItem].cityList, function(i, item) {
                        addEle(city, item.name);
                    })
                    //重新渲染select
                    form.render('select');
                })

                ////选定市或直辖县后 将对应的数据读取追加上
                form.on('select(city)', function(data) {
                    cityText = data.value;
                    removeEle(district);
                    $.each(provinceList, function(i, item) {
                        if (provinceText == item.name) {
                            cityItem = i;
                            return cityItem;
                        }
                    });
                    $.each(provinceList[cityItem].cityList, function(i, item) {
                        if (cityText == item.name) {
                            for (var n = 0; n < item.areaList.length; n++) {
                                addEle(district, item.areaList[n]);
                            }
                        }
                    })
                    //重新渲染select
                    form.render('select');
                })
            });
            layui.use('element', function(){
                var $ = layui.jquery
                    ,element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块

                //触发事件
                var active = {
                    tabAdd: function(){
                        //新增一个Tab项
                        element.tabAdd('demo', {
                            title: '新选项'+ (Math.random()*1000|0) //用于演示
                            ,content: '内容'+ (Math.random()*1000|0)
                            ,id: new Date().getTime() //实际使用一般是规定好的id，这里以时间戳模拟下
                        })
                    }
                    ,tabDelete: function(othis){
                        //删除指定Tab项
                        element.tabDelete('demo', '44'); //删除：“商品管理”


                        othis.addClass('layui-btn-disabled');
                    }
                    ,tabChange: function(){
                        //切换到指定Tab项
                        element.tabChange('demo', '22'); //切换到：用户管理
                    }
                };

                $('.site-demo-active').on('click', function(){
                    var othis = $(this), type = othis.data('type');
                    active[type] ? active[type].call(this, othis) : '';
                });

                //Hash地址的定位
                var layid = location.hash.replace(/^#test=/, '');
                element.tabChange('test', layid);

                element.on('tab(test)', function(elem){
                    location.hash = 'test='+ $(this).attr('lay-id');
                });

            });
            this.getCashflowTypes();
        },
        updated: function () {
            layui.form.render('select');
            layui.form.render();
        },
        methods: {
            initTypesSelect: function () {
                layui.xmSelect.render({
                    el: '#cashflowtype',
                    tips: '请选择操作类型',
                    name: 'cftype',
                    prop: {
                        name: 'dicttext',
                        value: 'dictkey'
                    },
                    data: this.cashflowTypes
                })
            },
            search: function () {
                this.getPageData('search');
            },
            getCashflowTypes: function() {
                let that = this;
                this.axios({
                    method: 'get',
                    responseType: 'json',
                    url: '/sales/Sellform!findDict.action',
                    params: {type: 110}
                }).then(response => {
                    if (response.statusText == "OK") {
                        that.cashflowTypes = response.data;
                        console.log('cashflowTypes:', that.cashflowTypes)
                        that.initTypesSelect();
                    } else {
                        this.toastText('获取预收款类型数据失败');
                    }
                });
            },
            guidePage: function() {
                if (this.$store.state.customerActype == 'recbalance') {
                    let elemTit = $('.layui-tab-title li');
                    let elemCont = $('.layui-tab-item');
                    for (let i=0; i<elemCont.length; i++) {
                        elemTit.eq(i).removeClass('layui-this');
                        elemCont.eq(i).removeClass('layui-show');
                    }
                    elemTit.eq(3).addClass('layui-this');
                    elemCont.eq(3).addClass('layui-show');
                }
            },
            reload: function() {
                this.getCustomer(this.id);
                $('#starttime').val('');
                $('#endtime').val('');
                $('#cashflowtype').val('');
            },
            back: function () {
                this.$parent.switchPage(this.$parent.refView);
            },
            getPageData: function (type = '') {
                let that = this;
                let loader = layui.layer.load();

                let postData = {};
                postData.customerid = this.id;
                postData.starttime = $('#starttime').val();
                postData.endtime = $('#endtime').val();
                postData.types = $('input[name="cftype"]').val();

                this.$post('/sales/Customer!getCashflow.action',qs.stringify(postData))
                    .then(response => {
                        let data = response.data;
                        if (data.msg == 'success') {
                            this.cashflow = data.cashflows;
                        } else {
                            this.toast('查询预收款数据失败！');
                        }
                        layer.close(loader);
                    })
            },
            /**
             * 2020-3-30
             * Liukx
             */
            getCustomer: function(id) {
                let loader = layui.layer.load();
                this.$post('/sales/Customer!detail.action',qs.stringify({customerid: id}))
                    .then(response => {
                        let data = response.data;
                        if (data.msg == 'success') {
                            this.customer = data.customer;
                            this.baseinfo = data.customer.baseinfo == null ? '' :data.customer.baseinfo;
                            this.financeinfo = data.customer.financeinfo == null ? '' :data.customer.financeinfo;
                            this.cashflow = data.customer.cashflows == null ? [] :data.customer.cashflows;
                            this.receivableflow = data.customer.receivableflows == null ? [] :data.customer.receivableflows;
                            $('#province').val( this.customer.province);
                            $('#city').append(new Option( this.customer.city,  this.customer.city));
                            $('#district').append(new Option( this.customer.district, this.customer.district));
                            $('#type').val(this.customer.type);
                        } else {
                            this.toast('获取客户信息失败！');
                        }
                        layer.close(loader);
                    })
            },/**
             * 2020-3-30
             * Liukx
             * 添加管理类型
             */
            getDictEmnu: function() {
                this.$post('/sales/Customer!getDictEmnu.action')
                    .then(response => {
                        let data = response.data;
                        if (data.info != 'error') {
                            this.typeEmnu = data.info== null?"":data.info;
                        } else {
                            this.toast('获取管理类型失败！');
                        }
                    })
            }, getCurrencyEmnu: function() {
                this.$post('/sales/Customer!getCurrencyEmnu.action')
                    .then(response => {
                            this.currencydict = response.data.info;
                    });
            },
            getCusTypes: function() {
                let that = this;
                this.axios({
                    method: 'get',
                    responseType: 'json',
                    url: '/sales/Sellform!findDict.action',
                    params: {type: 119}
                }).then(response => {
                    if (response.statusText == "OK") {
                        that.cusTypes = response.data;
                    } else {
                        this.toastText('获取客户类型数据失败');
                    }
                });
            }
        }
    }
</script>
